package com.bysj.yqsht.web.controller;

import com.bysj.yqsht.service.IPhotoService;
import com.bysj.yqsht.utils.Message;
import com.bysj.yqsht.utils.MessageUtil;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("photo")
@Api(description = "照片上传接口")
public class PhotoController {
   @Autowired
   private IPhotoService photoService;
    //上传头像
    @PostMapping
    public Message uploadOssFile(MultipartFile file){
        //MultipartFile  获取上传文件
        //返回上传到OSS里面的路径
        String url= photoService.uploadFileAvatar(file);
        System.out.println(url);
        return  MessageUtil.success("成功",url);
    }

}
